==========================================================================================
                                                                     
		               O-Ring Production Networks
			        By Demir-Fieler-Xu-Yang

				 Replication (Part II)

==========================================================================================


==========================================================================================

		Part II-A: Model Estimation and Counterfactuals

==========================================================================================

=================
Software version
=================

All programs in Part II-A were run with Matlab R2021b.


===============================================
Replication: one-click using the master file
===============================================

- Run program "/Part II/program files/master_m_file.m": It will produce Figure 4, Figure 5, Figure 6, Figure A8, Table 6, Table 7, Table 8, Table 9, Table 10, Table A21, Table A22, Table A23, Table A24, Table A25.


====================================================================
Replication: separately for each part of the analysis in subfolders
====================================================================

* Estimation and Model Fit (Folder "/Part II/program files/1 estimation")
- Run program "main_fullmodel_estimation.m": It will estimate the full model and save the parameter estimates.
- Run program "main_fullmodel_moments.m": It will compute the model fit and produce Table 7 and Figure 4.


* Standard Error (Folder "/Part II/program files/2 standard error")
- Run program "main_fullmodel_standarderror.m": It will compute the standard errors and produce Table 6.


* Baseline Export Shock Counterfactual (Folder "/Part II/program files/3 baseline counterfactual")
- Run program "main_baseline_counterfactual.m": It will conduct the baseline export shock counterfactual analysis and produce Figure 5, Figure 6A, and Table 8A.


* Export Subsidy Counterfactuals (Folder "/Part II/program files/4 export subsidy counterfactuals")
- Run program "main_exportsubsidy_counterfactual.m": It will conduct the export subsidy counterfactual analyses under different scenarios and produce Figure 6B, Table 8B, and Table 10.


* Dissecting Mechanisms (Folder "/Part II/program files/5 dissecting mechanisms")
- Run program "main_disecting_mechanisms.m": It will calibrate special cases of the models, repeat the baseline export shock counterfactual with each special case, and produce Table 9 and Table A25.


* Model with Imports (Folder "/Part II/program files/6 model with imports")
- Run program "main_import_counterfactual.m": It will calibrate a model with both imports and exports, repeat the baseline export shock counterfactual using the model with imports, and produce Table A22, Table A23, and Table A24. 


* Endogenous Targeting (Folder "/Part II/program files/7 endogenous targeting")
- Run programs "main_endogtarget_1_initeqm_grid.m", "main_endogtarget_2_wageresponse_cf.m", "main_endogtarget_3_select_modelfit.m": They will check robustness of our baseline export shock counterfactual results to endogenous targeting, and produce Table A21 and Figure A8.



==========================================================================================

		Part II-B: Additional Evaluation of Estimation Results

==========================================================================================
 
=================
Software version
=================

All programs in Part II-B were run with Matlab R2021b and State/SE 17.0.


====================================================================
Replication: separately for each part of the analysis in subfolders
====================================================================

* Data CI and Model Moments (Folder "/Part II/program files/8 data ci")
- Run program "CI.do": It will plot model moments with data confidence interval and produce Figure A7.


* Sensitivity Analysis (Folder "/Part II/program files/9 sensitivity analysis")
- Run program "main_sensitivity_analysis_1.m": It will calculate the Jacobian used for the sensitivity analysis.
- Run program "main_sensitivity_analysis_2.do": It will load the Jacobian and conduct the sensitivity analysis.
  




